/**
 * @file boards\gd32f303cx_mr7202\config\flash_map.h
 *
 * Copyright (C) 2022
 *
 * flash_map.h is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 * @author HinsShum hinsshum@qq.com
 *
 * @encoding utf-8
 */
#ifndef __FLASH_MAP_H
#define __FLASH_MAP_H

#ifdef __cplusplus
extern "C"
{
#endif

/*---------- includes ----------*/
#include <stdint.h>
#include <stdbool.h>
#include <stddef.h>

/*---------- macro ----------*/
/* SRAM definition
 */
#define CONFIG_SRAM_BASE                (SRAM_BASE)
#define CONFIG_SRAM_SIZE                (48 * 1024)
#define CONFIG_SRAM_END                 (CONFIG_SRAM_BASE + CONFIG_SRAM_SIZE)

/* flash definition
 */
#define CONFIG_FLASH_BASE               (FLASH_BASE)
#define CONFIG_FLASH_SIZE               (0x40000)
#define CONFIG_FLASH_BLOCK_SIZE         (0x800)
#define CONFIG_FLASH_END                (CONFIG_FLASH_BASE + CONFIG_FLASH_SIZE)

/* application address definition
 * the address is an offset from the base address of
 * the flash memory.
 */
#define CONFIG_APPLICATION_ADDRESS      (0x4000)
#define CONFIG_APPLICATION_MAX_SIZE     (CONFIG_FLASH_SIZE - CONFIG_APPLICATION_ADDRESS)
/* chip uuid
 */
#define CONFIG_CHIP_UUID_BASE                   (0x1FFFF7E8)
#define CONFIG_CHIP_UUID_SIZE                   (12)


/* at24c512 map
 */
#define CONFIG_AT24CXX_BASE                     (0x0)
#define CONFIG_AT24CXX_SIZE                     (0x10000)
#define CONFIG_AT24CXX_BLKSIZE                  (0x80)
#define CONFIG_AT24CXX_END                      (CONFIG_AT24CXX_BASE + CONFIG_AT24CXX_SIZE)
#define CONFIG_AT24CXX_WRITE_GRAN               (8)


/*---------- type define ----------*/
/*---------- variable prototype ----------*/
/*---------- function prototype ----------*/

#ifdef __cplusplus
}
#endif
#endif /* __FLASH_MAP_H */
